package com.kun.base.net


import com.kun.base.env.Constants
import com.kun.base.util.MMKVUtils
import okhttp3.Interceptor
import okhttp3.Response

/**
 *
 *
 * @author : Kun
 * @date : 2021/5/18 17:45
 */
class ParamsInterceptor() :Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val original = chain.request()
        val originalHttpUrl = original.url()
        val builder = originalHttpUrl.newBuilder()
        val url = builder.build()
        val requestBuilder = original.newBuilder()
            .url(url) //
//            .addHeader("Cookie", "JSESSIONID=" + MMKVUtils.get(Constants.TOKEN, ""))
        val request = requestBuilder.build()

        return chain.proceed(request)
    }
}